package com.springlearn.springsourcecode.chap6;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wtcode
 * @Description
 * @date 2025/3/31 - 9:57
 */
@Configuration
public class MyConfig2 implements InitializingBean, ApplicationContextAware {


    public static final Logger log = LoggerFactory.getLogger(MyConfig2.class);


    @Override
    public void afterPropertiesSet() throws Exception {
        log.debug("初始化");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        log.debug("注入applicationContext");
    }

    @Bean
    public BeanFactoryPostProcessor processor2(){
        return beanFactory->
            log.debug("执行process2");
    }
}
